package com.yaoq.iterator;

import java.util.Iterator;

/**
 * @ClassName ComputerCollege
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/9/9 13:56
 * @Version 1.0
 */
public class ComputerCollege implements College {
    Department[] departments;
    int numOfDepartment = 0;

    public ComputerCollege() {
        departments = new Department[5];
        addDepartment("java专业", "java专业");
        addDepartment("Python专业", "Python专业");
        addDepartment("区块链专业", "区块链专业");
    }

    @Override
    public String getName() {

        return "计算机学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departments[numOfDepartment] = department;
        numOfDepartment += 1;
    }

    @Override
    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
